package com.mumu.system.controller;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.mumu.system.service.PermissionService;
import com.mumu.system.vo.PermissionVO;

@Controller
@RequestMapping("/Permission")
public class PermissionController {

	@Autowired private PermissionService permissionService;
	
	@ResponseBody
	@RequestMapping("/getMenuList")
	public Map<String, Object> getMenuList() {
		Map<String, Object> permissionsVOList = permissionService.getMenuList();
		return permissionsVOList;
	}
	
	@ResponseBody
	@RequestMapping("/getPermissionList")
	public List<PermissionVO> getPermissionList() {
		return permissionService.getPermissionList();
	}
	
	/**
	 * 添加权限
	 * */
	@RequestMapping(value = "addPermission")
	@ResponseBody
	public void addDeptList(@RequestBody PermissionVO permissionsVO) throws Exception{
		permissionService.addPermission(permissionsVO);
	};
	
	/**
	 * 修改权限
	 * */
	@RequestMapping(value = "editPermission")
	@ResponseBody
	public void editPermission(@RequestBody PermissionVO permissionVO) {
		permissionService.editPermission(permissionVO);
	};
	
	/**
	 * 删除权限
	 * */
	@RequestMapping(value = "delPermission")
	@ResponseBody
	public void delPermission(Integer id) {
		permissionService.delPermission(id);
	};

}
